import request from '@/config/axios'

// 获取食谱列表
export function getRecipes(params) {
  return request({
    url: '/recipes',
    method: 'get',
    params
  })
}

// 获取食谱详情
export function getRecipeDetail(id) {
  return request({
    url: `/recipes/${id}`,
    method: 'get'
  })
}

// 搜索食谱
export function searchRecipes(params) {
  return request({
    url: '/recipes/search',
    method: 'get',
    params
  })
}

// 获取分类食谱
export function getCategoryRecipes(category) {
  return request({
    url: `/recipes/category/${category}`,
    method: 'get'
  })
}

// 收藏食谱
export function favoriteRecipe(recipeId) {
  return request({
    url: `/recipe/favorites/${recipeId}`,
    method: 'post'
  })
}

// 取消收藏
export function unfavoriteRecipe(recipeId) {
  return request({
    url: `/recipe/favorites/${recipeId}`,
    method: 'delete'
  })
}

// 获取收藏列表
export function getFavorites() {
  return request({
    url: '/recipe/favorites',
    method: 'get'
  })
}

// 检查是否已收藏
export function checkFavorite(recipeId) {
  return request({
    url: `/recipe/favorites/check/${recipeId}`,
    method: 'get'
  })
} 